// 高端定制
function dingzhi() {
    let mockData = Mock.mock({
        "addInfo": {
            "userName": "黄熊猫",
            "cellPhone": "18795881524",
            "address": "快回答是雷锋好鲁大师发生了复活甲了"
        },
        "dzParams": [{
                "type": "上衣",
                "ml": [{
                        "tag": "新品",
                        "type": "全棉",
                        "imgList": [{
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "1白色#1202"
                        }, {
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "1红色#1202"
                        }, {
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "1黑色#1202"
                        }]
                    },
                    {
                        "tag": "畅销",
                        "type": "洗涤",
                        "imgList": [{
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "白色#1202"
                        }, {
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "红色#1202"
                        }, {
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "黑色#1202"
                        }]
                    }
                ],
                "lingx": [{
                    "type": "大翻领"
                }, {
                    "type": "小翻领"
                }, {
                    "type": "中式立领"
                }],
                "xiab": [{
                    "type": "一支信"
                }, {
                    "type": "小翻领"
                }, {
                    "type": "中式立领"
                }],
                "bodyType": [{
                        "type": "偏瘦"
                    }, {
                        "type": "中等"
                    },
                    {
                        "type": "偏胖"
                    }
                ],
                "dzRequire": [{
                    "name": "请填写您的体重",
                    "unit": "KG"
                }, {
                    "name": "请填写您的身高",
                    "unit": "CM"
                }, {
                    "name": "请填写您的体重",
                    "unit": "KG"
                }, {
                    "name": "请填写您的体重",
                    "unit": "KG"
                }, {
                    "name": "请填写您的体重",
                    "unit": "KG"
                }, {
                    "name": "请填写您的体重",
                    "unit": "KG"
                }]
            },
            {
                "type": "西服",
                "ml": [{
                        "tag": "新品1",
                        "type": "全棉1",
                        "imgList": [{
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "白色1#1202"
                        }, {
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "红色1#1202"
                        }, {
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "黑色1#1202"
                        }]
                    },
                    {
                        "tag": "畅销1",
                        "type": "洗涤1",
                        "imgList": [{
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "白色#1202"
                        }, {
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "红色#1202"
                        }, {
                            "imgUrl": "@image('202x202',#eac7ce)",
                            "description": "黑色#1202"
                        }]
                    }
                ],
                "lingx": [{
                    "type": "大翻领1"
                }, {
                    "type": "小翻领1"
                }, {
                    "type": "中式立领1"
                }],
                "xiab": [{
                    "type": "一支信1"
                }, {
                    "type": "小翻领1"
                }, {
                    "type": "中式立领1"
                }],
                "bodyType": [{
                        "type": "偏瘦1"
                    }, {
                        "type": "中等1"
                    },
                    {
                        "type": "偏胖1"
                    }
                ],
                "dzRequire": [{
                    "name": "请填写您的体重",
                    "unit": "KG"
                }, {
                    "name": "请填写您的体重",
                    "unit": "KG"
                }, {
                    "name": "请填写您的体重",
                    "unit": "KG"
                }]
            }
        ],
    })
    new Vue({
        el: "#dingzhi",
        data() {
            return {
                addInfo: "",
                dzParams: "",
                selIndex: 0, //一级选项 index
                secondIndex: 0 //二级选项 index
            }
        },
        methods: {
            getInfo: function() {
                let dzUrl = `${urlParam.domain()}api/customization/customizationInfo`;
                axios({
                    url: dzUrl,
                    method: "get",
                }).then(res => {
                    console.log(res)
                    this.dzParams = res.data.data.customizationParams[0].categoryParams;
                })
                this.addInfo = mockData.addInfo;
                // this.dzParams = mockData.dzParams;
            },
            // 类型选择
            sel: function(index) {
                this.selIndex = index;
            },
            secondSel: function(index) {
                this.secondIndex = index;
            },
            submit: function() {
                let submitUrl = `${urlParam.domain()}api/customization/addCustomInfo`;
                axios({
                    url: submitUrl,
                    method: "post",
                    params: {
                        token: urlParam.token(),
                        addressId: "21",
                        content: '{"countMoney": 2400}',
                        customCount: 200
                    }
                }).then(res => {
                    console.log("submit", res);
                }).catch(err => {
                    console.log(err)
                })
            }
        },
        created() {
            this.getInfo();
        },
        components: {
            counter,
        }
    })
}